/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package clip.net;

import clip.model.Buddy;
import clip.model.ClipboardSnapshot;
import java.awt.Toolkit;
import java.net.URL;
import java.rmi.RemoteException;
import java.rmi.server.UnicastRemoteObject;
import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author admin
 */
public class RMIApiImpl extends UnicastRemoteObject implements RMIApiInterface {

    Buddy buddy;
    RMIServer server;

    public RMIApiImpl(RMIServer server) throws RemoteException {
        super();
        this.server = server;
    }

    public String getTestString() throws RemoteException {
        return "SERVUS GUTEN TAG VON RMIApiImpl !!! DIES IST EIN TESTSTRING, WIR WÜNSCHEN VIEL VERGNÜGEN IM WEITEREN PROGRAMM";
    }

    public ClipboardSnapshot getClipboardSnapshot() throws RemoteException {
        return new ClipboardSnapshot(Toolkit.getDefaultToolkit().getSystemClipboard());
    }

    public boolean checkConnectionAlive() throws RemoteException {
        return true;
    }

    public void notifyStatusChanged(Status status) throws RemoteException {
        //TODO
    }

    public boolean receiveMessage(String message) {
        server.getApp().trayIcon.displayBalloonMessage(this.buddy.getNickname()+" : "+message);
        return true;
    }

    public List<FileInfo> getSharedFiles() {
        //TODO handle
        return null;
    }
}
